<?php
/**
 * Created by 784855684@qq.com.
 * Link: https://github.com/lichtung/wshore
 * User: linzh
 * Date: 6/30/17
 * Time: 3:25 PM
 */
declare(strict_types=1);


namespace application\module\admin\addon\sign\model;

use application\module\admin\addon\model\AddonModel;

/**
 * Class UserLogModel
 *
 * @property string $username 用户名
 * @property string $time 时间
 * @property string $ip 登录IP
 * @property string $type 类型 (I-sign in O-sign out U-sign up)
 * @property string $res 操作结果( S-success F-failure)
 * @property string $client  客户端(浏览器)类型
 *
 * @package application\module\admin\addon\sign\model
 */
class SignLogModel extends AddonModel
{

    protected function struct(): string
    {
     return "  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT '账户名称',
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '登录时间',
  `ip` varchar(32) COLLATE utf8_unicode_ci NOT NULL COMMENT '登录IP',
  `type` enum('I','O','U') CHARACTER SET ascii NOT NULL COMMENT 'I-sign in O-sign out U-sign up',
  `res`  enum('S','F')      CHARACTER SET ascii NOT NULL COMMENT '操作结果 S-success F-failure',
  `client` varchar(255) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT '客户端(浏览器)类型',
  PRIMARY KEY (`id`)";
    }

    protected function tableName()
    {
        return 'user_log';
    }
}